package com.luyun.frogpay.base.dagger.fragment.module;

import android.app.Activity;
import android.content.Context;

import androidx.fragment.app.Fragment;

import com.luyun.frogpay.base.annotator.ContextForActivity;
import com.luyun.frogpay.base.annotator.PerformFragment;

import dagger.Module;
import dagger.Provides;

/**
 * @author 无人区
 * @date 2019/10/27 15:47
 * @desc:
 */
@Module
public class FragmentModule {

    private Fragment fragment;

    public FragmentModule(Fragment fragment) {
        this.fragment = fragment;
    }

    @PerformFragment
    @Provides
    @ContextForActivity
    public Context provideActivityContext(){
        return fragment.getActivity();
    }

    @PerformFragment
    @Provides
    public Activity provideActivity(){
        return fragment.getActivity();
    }

    @PerformFragment
    @Provides
    public Fragment provideFragment(){
        return fragment;
    }
}
